package com.kma.summer2012.model;
// Generated Dec 6, 2012 12:14:41 AM by Hibernate Tools 3.2.1.GA


import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * CrumbsRequest generated by hbm2java
 */
@Entity
@Table(name = "CRUMBS_REQUEST"
        , schema = "KMA1"
)
public class CrumbsRequest implements java.io.Serializable {


    private int id;
    private CrumbsClient crumbsClient;
    private CrumbsRequestsState crumbsRequestsState;
    private Date dateOfCreation;
    private String requestInfo;
    private Integer actualTimeOfWork;
    private Set<CrumbsUser> crumbsUsers = new HashSet<CrumbsUser>(0);
    private Set<CrumbsProcessHistory> crumbsProcessHistories = new HashSet<CrumbsProcessHistory>(0);
    private Set<CrumbsAdditionalTools> crumbsAdditionalToolses = new HashSet<CrumbsAdditionalTools>(0);
    private Set<CrumbsRequestAndWork> crumbsRequestAndWorks = new HashSet<CrumbsRequestAndWork>(0);
    private Set<CrumbsDateAndTime> crumbsDateAndTimes = new HashSet<CrumbsDateAndTime>(0);

    public CrumbsRequest() {
    }


    public CrumbsRequest(int id, CrumbsClient crumbsClient, CrumbsRequestsState crumbsRequestsState, Date dateOfCreation) {
        this.id = id;
        this.crumbsClient = crumbsClient;
        this.crumbsRequestsState = crumbsRequestsState;
        this.dateOfCreation = dateOfCreation;
    }

    public CrumbsRequest(int id, CrumbsClient crumbsClient, CrumbsRequestsState crumbsRequestsState,
                         Date dateOfCreation, String requestInfo, Integer actualTimeOfWork,
                         Set<CrumbsUser> crumbsUsers, Set<CrumbsProcessHistory> crumbsProcessHistories,
                         Set<CrumbsAdditionalTools> crumbsAdditionalToolses,
                         Set<CrumbsRequestAndWork> crumbsRequestAndWorks,
                         Set<CrumbsDateAndTime> crumbsDateAndTimes) {
        this.id = id;
        this.crumbsClient = crumbsClient;
        this.crumbsRequestsState = crumbsRequestsState;
        this.dateOfCreation = dateOfCreation;
        this.requestInfo = requestInfo;
        this.actualTimeOfWork = actualTimeOfWork;
        this.crumbsUsers = crumbsUsers;
        this.crumbsProcessHistories = crumbsProcessHistories;
        this.crumbsAdditionalToolses = crumbsAdditionalToolses;
        this.crumbsRequestAndWorks = crumbsRequestAndWorks;
        this.crumbsDateAndTimes = crumbsDateAndTimes;
    }

    @Id

    @Column(name = "ID", unique = true, nullable = false, precision = 9, scale = 0)
    public int getId() {
        return this.id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "CLIENT_ID", nullable = false)
    public CrumbsClient getCrumbsClient() {
        return this.crumbsClient;
    }

    public void setCrumbsClient(CrumbsClient crumbsClient) {
        this.crumbsClient = crumbsClient;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "STATE_ID", nullable = false)
    public CrumbsRequestsState getCrumbsRequestsState() {
        return this.crumbsRequestsState;
    }

    public void setCrumbsRequestsState(CrumbsRequestsState crumbsRequestsState) {
        this.crumbsRequestsState = crumbsRequestsState;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "DATE_OF_CREATION", nullable = false, length = 7)
    public Date getDateOfCreation() {
        return this.dateOfCreation;
    }

    public void setDateOfCreation(Date dateOfCreation) {
        this.dateOfCreation = dateOfCreation;
    }

    @Column(name = "REQUEST_INFO", length = 500)
    public String getRequestInfo() {
        return this.requestInfo;
    }

    public void setRequestInfo(String requestInfo) {
        this.requestInfo = requestInfo;
    }

    @Column(name = "ACTUAL_TIME_OF_WORK", precision = 9, scale = 0)
    public Integer getActualTimeOfWork() {
        return this.actualTimeOfWork;
    }

    public void setActualTimeOfWork(Integer actualTimeOfWork) {
        this.actualTimeOfWork = actualTimeOfWork;
    }

    @ManyToMany(cascade = {CascadeType.REFRESH, CascadeType.MERGE, CascadeType.PERSIST}, fetch = FetchType.LAZY)
    @JoinTable(name = "CRUMBS_REQUEST_ASSIGN", schema = "KMA1", joinColumns = {
            @JoinColumn(name = "REQUEST_ID", nullable = false, updatable = false)}, inverseJoinColumns = {
            @JoinColumn(name = "USER_ID", nullable = false, updatable = false)})
    public Set<CrumbsUser> getCrumbsUsers() {
        return this.crumbsUsers;
    }

    public void setCrumbsUsers(Set<CrumbsUser> crumbsUsers) {
        this.crumbsUsers = crumbsUsers;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "crumbsRequest")
    public Set<CrumbsProcessHistory> getCrumbsProcessHistories() {
        return this.crumbsProcessHistories;
    }

    public void setCrumbsProcessHistories(Set<CrumbsProcessHistory> crumbsProcessHistories) {
        this.crumbsProcessHistories = crumbsProcessHistories;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "crumbsRequest")
    public Set<CrumbsAdditionalTools> getCrumbsAdditionalToolses() {
        return this.crumbsAdditionalToolses;
    }

    public void setCrumbsAdditionalToolses(Set<CrumbsAdditionalTools> crumbsAdditionalToolses) {
        this.crumbsAdditionalToolses = crumbsAdditionalToolses;
    }

    @OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, mappedBy = "crumbsRequest")
    public Set<CrumbsRequestAndWork> getCrumbsRequestAndWorks() {
        return this.crumbsRequestAndWorks;
    }

    public void setCrumbsRequestAndWorks(Set<CrumbsRequestAndWork> crumbsRequestAndWorks) {
        this.crumbsRequestAndWorks = crumbsRequestAndWorks;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "crumbsRequest")
    public Set<CrumbsDateAndTime> getCrumbsDateAndTimes() {
        return this.crumbsDateAndTimes;
    }

    public void setCrumbsDateAndTimes(Set<CrumbsDateAndTime> crumbsDateAndTimes) {
        this.crumbsDateAndTimes = crumbsDateAndTimes;
    }


}


